Skip to content

fix: share the EP tutorial centre and implement width regression - #75

Merged
Jammy2211 merged 4 commits into
mainfrom
feature/howtofit-ep-shared-centre
Oct 23, 2026
Merged

Jammy2211 merged 4 commits into
mainfrom
feature/howtofit-ep-shared-centre

Conversation

@Jammy2211

@Jammy2211 Jammy2211 commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Tutorial 5 declared a shared centre but assigned independent priors, and its regression factor returned constant -1. Assign the same centre prior to every profile and replace the placeholder with a Gaussian width-relation density. The tutorial now checks that every dataset/regression factor actually updated, and smoke CI runs it with real sampling.

Closes #73.

Scripts Changed

  • scripts/chapter_advanced/tutorial_5_expectation_propagation.py: shared centre; explicit FWHM collection; Gaussian width relation; explanation of the modelling assumption and rejected projections; stale-factor guard.
  • config/build/no_run.yaml: remove the obsolete exclusion.
  • config/build/profile_smoke.yaml: use PYAUTO_TEST_MODE=0 for this tutorial so constant likelihoods cannot hide behind sampler bypass.
  • Regenerated notebook and navigator catalogue through PyAutoHands.

Modelling choice for review

The formerly unexplained regression is now explicitly a teaching assumption: FWHM_i scatters around m*i+c, using dataset index i=0,1,2 and fixed scatter 5 pixels. These are inferred widths, not invented extra observations. The c prior is centred on FWHM(sigma=10), with sigma=10 pixels; m has mean=0 and sigma=5. The author should review whether this is the desired pedagogical example. Five sweeps demonstrate updates, not guaranteed convergence. No upstream library API change.

Validation

  • Real headless sampling exited 0, no STALE FACTORS warning.
  • Additional bounded witness execution (not an independent review): shared prior identity across all three datasets; normalized Gaussian log density at an exact relation; changing m, c or a width lowers that density.
  • Inspected generated model and state figures: blue shared x3 centre; 5 updates / 5 sweeps for dataset_0, dataset_1, dataset_2 and linear_regression; 0 stale. One marginal projection was rejected in the seeded witness and is shown honestly as reverting; no convergence claim.
  • Full smoke discovery: 17 passed, 2 failed solely because blackjax was absent. Installed the declared BlackJAX dependency and reran both failures plus final EP script: 3 passed, including final stale-factor guard and real-sampling smoke override. Thus all 19 discovered runnable scripts were exercised successfully across these runs.
  • Regenerated notebook includes revised code/prose; catalogue diff is only the added Width Relation section; git diff --check passed.
  • Heart vitals: STALE, published reason release validation stale: source moved since rehearsal (PyAutoFit, PyAutoGalaxy, PyAutoLens). No release claimed.

Part of four authorized linked teaching tasks. Stop at human review; no merge authorization. Runtime-guidance PR #74 is independent; this PR starts from main.

CI prerequisite found during validation

Both Python 3.12 and 3.13 smoke jobs on the runtime-only PR #74 fail because BlackJAX is absent for gradient tutorials 6/7. Add the already-declared blackjax>=1.6.2 dependency to the workspace-owned .github/scripts/smoke_install.sh; no workflow or Python-matrix change. The two tutorials pass locally with this dependency installed. This prerequisite belongs here with restoration of smoke coverage; #74 should be revalidated after this PR lands.

Copy link
Copy Markdown
Contributor Author

Prm review on 2026-10-17: merge blocked. Exact-head smoke run 39055282617 fails on both Python 3.12 and 3.13 at Run the workspace runner. Failure: tutorial_6_gradients.py: Nautilus requires importable module nautilus: No module named 'nautilus'. Logs fetched now: jobs 117461916051 / 117461916111. BlackJAX is now present; the remaining CI installation gap is Nautilus. The existing local smoke passed because Nautilus had already been installed for PyAutoFit validation. No rerun or merge performed; a code-fix step must install the declared Nautilus dependency before revalidation. Navigator and Tutorials Complete checks pass.

Smoke run 39055282617 failed on 3.12 and 3.13: tutorial_6_gradients.py
needs nautilus, a PyAutoFit optional dependency the base install omits.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Qy3Nc9rZwKHwQgPt8kMyeD
@Jammy2211
Jammy2211 merged commit be3c7ab into main Oct 23, 2026
8 checks passed
@Jammy2211
Jammy2211 deleted the feature/howtofit-ep-shared-centre branch October 23, 2026 22:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: make tutorial 5 share its centre and fit its regression

1 participant